#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
using namespace std;
class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        vector<int> ans;
        if (nums.size() == 0)
        {
            ans.push_back(-1);
            ans.push_back(-1);
            return ans;
        }
        int z, y, mid, ansz, ansy;
        z = 0, y = nums.size() - 1;
        while (z <= y)
        {
            mid = z + y;
            mid /= 2;
            if (nums[mid] <= target)z = mid + 1;
            else y = mid - 1;
        }
        if (nums[mid] != target)mid--;
        if (mid < 0 || nums[mid] != target)
        {
            ans.push_back(-1);
            ans.push_back(-1);
            return ans;
        }
        ansy = mid;
        z = 0, y = nums.size() - 1;
        while (z <= y)
        {
            mid = z + y;
            mid /= 2;
            if (nums[mid] < target)z = mid + 1;
            else y = mid - 1;
        }
        if (nums[mid] != target)mid++;
        ansz = mid;
        ans.push_back(ansz);
        ans.push_back(ansy);
        return ans;
    }
};
int main()
{
    Solution sol;
}